package com.yuebao.sender;


import com.yuebao.event.EventDTO;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class CommonSender {
    
    @Resource
    private RocketMQTemplate rocketMQTemplate;
    
    public void send(String topic, String tag, EventDTO eventDTO)  {

        rocketMQTemplate.convertAndSend(topic+":"+tag,eventDTO);
    }
    
    public SendResult syncSend(String topic, String tag, EventDTO eventDTO)  {
    
        return rocketMQTemplate.syncSend(topic+":"+tag,eventDTO);
        
    }
}
